import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '机型编码',
    align:"center",
    dataIndex: 'modelCode'
   },
   {
    title: '机型名称',
    align:"center",
    dataIndex: 'modelName'
   },
   {
    title: '机型描述',
    align:"center",
    dataIndex: 'description'
   },
   {
    title: '是否启用',
    align:"center",
    dataIndex: 'isEnabled_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '机型编码',
    field: 'modelCode',
    component: 'Input',
    colProps: { span: 12},
  },
  {
    label: '机型名称',
    field: 'modelName',
    component: 'Input',
    colProps: { span: 12},
  },
  {
    label: '是否启用',
    field: 'isEnabled',
    component: 'RadioButtonGroup',
    componentProps: {
      options: [
        { label: '启用', value: '0' },
        { label: '停用', value: '1' },
      ],
    },
    colProps: { span: 12},
  },
  {
    label: '机型描述',
    field: 'description',
    component: 'Input',
  },

	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
export const profileMachineDemandFormSchema: JVxeColumn[] = [

  {
    title: '型材位置',
    key: 'positionId',
    type: JVxeTypes.selectDictSearch,
    width:"200px",
    async: true,
    // 字典表配置信息：数据库表名,显示字段名,存储字段名
    dict: 'profile_position,position_name,id ',
    tipsContent: '请输入',
  },
  {
    title: '型材规格',
    key: 'specId',
    type: JVxeTypes.selectDictSearch,
    width:"200px",
    async: true,
    // 字典表配置信息：数据库表名,显示字段名,存储字段名
    dict: 'profile_spec,spec_name,id ',
    tipsContent: '请输入',
  },
  {
    title: '单根需求长度',
    key: 'num',
    type: JVxeTypes.inputNumber,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '1',
  },

  {
    title: '需求数量',
    key: 'demandQuantity',
    type: JVxeTypes.inputNumber,
    width: "80px",
    placeholder: '请输入${title}',
    defaultValue: '1',
  },
  {
    title: '备注说明',
    key: 'remark',
    type: JVxeTypes.input,
    width: "80px",
    placeholder: '请输入${title}',
    defaultValue: '1',
  },

];
//子表表格配置


// 高级查询数据
export const superQuerySchema = {
  modelCode: {title: '机型编码',order: 0,view: 'text', type: 'string',},
  modelName: {title: '机型名称',order: 1,view: 'text', type: 'string',},
  description: {title: '机型描述',order: 2,view: 'text', type: 'string',},
  isEnabled: {title: '是否启用',order: 3,view: 'text', type: 'string',},
  //子表高级查询
  profileMachineDemand: {
    title: '机型需求实体类',
    view: 'table',
    fields: {
        deviceId: {title: '关联的设备机型ID',order: 0,view: 'text', type: 'string',},
        positionId: {title: '型材位置ID',order: 1,view: 'text', type: 'string',},
        specId: {title: '所需型材规格ID',order: 2,view: 'text', type: 'string',},
        demandLength: {title: '单根需求长度',order: 3,view: 'number', type: 'number',},
        demandQuantity: {title: '需求数量',order: 4,view: 'number', type: 'number',},
        remark: {title: '备注说明',order: 5,view: 'text', type: 'string',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
